package com.perfect;

import com.perfect.config.AppConfig;
import com.perfect.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {
    public static void main(String[] args) {

        // 创建AnnotationConfigApplicationContext对象，并注册AppConfig类
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(AppConfig.class);
        applicationContext.refresh();

        // 获取UserService对象
        UserService userService = applicationContext.getBean(UserService.class);
        userService.getUserNameById();


    }
}